#ifndef PACKAGE_H
#define PACKAGE_H

#include <QtCore>

enum PackageState
{
  None,
  Installed,
  NotLoaded,
  Broken,
  Partial,
  Loaded
};

enum PackageAction
{
  Skip,
  Install,
  ReloadInstall,
  LoadInstall
};

struct PackageInfo
{
  PackageInfo() :
      versionInstalled(0), versionServer(0),
      required(false),
      state(None),
      action(Skip)
  {
  }

    QString name, serverPath, localPath, extractPath, target;
    int versionInstalled, versionServer;
    QString versionInstalledText, versionServerText;
    bool required;
    int state, action;
};

class PackageData
{
public:
    PackageData();

    bool load(const QString &filename, bool installed);

    inline QMap<QString, PackageInfo>& packs() { return packages; }

protected:
    QMap<QString, PackageInfo> packages;
};

#endif // PACKAGE_H
